import { lazy } from "react";
import { createBrowserRouter } from 'react-router-dom'
import App from '../App'

const Home = lazy(() => import('../pages/home/Index'))
const Sou = lazy(() => import('../pages/sou/Index'))
const Shuo = lazy(() => import('../pages/shuo/Index'))
const Dian = lazy(() => import('../pages/dian/Index'))
const Ju = lazy(() => import('../pages/ju/Index'))

type homeRoutes = {
    path: string;
    element: JSX.Element;
    children?: { path: string; element: JSX.Element; }[]
}[]

const routes: homeRoutes = [
    {
        path: '/',
        element: <App></App>,
        children: [
            {
                path: '/home',
                element: <Home></Home>,
            },
            {
                path: '/sou',
                element: <Sou></Sou>,
            },
            {
                path: '/shuo',
                element: <Shuo></Shuo>,
            },
            {
                path: '/dian',
                element: <Dian></Dian>,
            },
            {
                path: '/ju',
                element: <Ju></Ju>,
            },
        ]
    },
]
const router = createBrowserRouter(routes)

export default router